﻿<%@ WebHandler Language="C#" Class="piece_get" %>

using System;
using System.Web;

public class piece_get : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        string uid = context.Request["uid"].ToString();
        TCMSPiece oPiece = new TCMSPiece(uid);
        oPiece.Select();
        string htmlcontent = oPiece.PieceContent.Replace("\"","'");
        string piece = "";
        piece += "{";
        piece += "\"piecename\":\"" + oPiece.PieceName + "\",";
        piece += "\"piececontent\":\"" + htmlcontent + "\"";
        //piece += "\"piececontent\":\"<p><img alt='' src='http://www.autocarcn.com/newsletter/200811/images/200811index_02.jpg' /></p>\"";
        piece += "}";

        context.Response.ContentType = "text/plain";
        context.Response.Write(piece);
        context.Response.End();
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}